package com.omt.tarjimdinek.domain.member.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.Size;

import org.apache.log4j.Logger;
import org.hibernate.validator.constraints.NotEmpty;

import com.google.common.base.Objects;
import com.omt.tarjimdinek.support.Identifiable;

/**
 * countries
 * @author chabane
 *
 */
@Entity
@Table(name="a01_pys")
public class Pays implements Identifiable<Integer>, Serializable {
	
    private static final long serialVersionUID = 1L;
    private static final Logger log = Logger.getLogger(Pays.class);
    
	/** code of country */
	@Column(name="COPYS", length=3)
	@Id
	private Integer codePays;
	
	/** name of country */
    @Size(max = 2)
    @NotEmpty
	@Column(name="alpha2", nullable=false, length=2)
	private String codeAlpha2;
    
    /** name of country */
    @Size(max = 3)
    @NotEmpty
	@Column(name="alpha3", nullable=false, length=3)
	private String codeAlpha3;
    
	/** name of country */
    @Size(max = 45)
    @NotEmpty
	@Column(name="langFR", nullable=false, length=45)
	private String libelle;

    @Size(max = 45)
    @NotEmpty
	@Column(name="langCS", nullable=false, length=45)
	private String libelleCS;
    
    @Size(max = 45)
    @NotEmpty
	@Column(name="langDE", nullable=false, length=45)
	private String libelleDE;
    
    @Size(max = 45)
    @NotEmpty
	@Column(name="langEN", nullable=false, length=45)
	private String libelleEN;
    
    @Size(max = 45)
    @NotEmpty
	@Column(name="langES", nullable=false, length=45)
	private String libelleES;
    
    @Size(max = 45)
    @NotEmpty
	@Column(name="langIT", nullable=false, length=45)
	private String libelleIT;
    
    @Size(max = 45)
    @NotEmpty
	@Column(name="langNL", nullable=false, length=45)
	private String libelleNL;
    
	/**
	 * @return the codePays
	 */
	public Integer getCodePays() {
		return codePays;
	}

	/**
	 * @param codePays the codePays to set
	 */
	public void setCodePays(Integer codePays) {
		this.codePays = codePays;
	}

	/**
	 * @return the libelle
	 */
	public String getLibelle() {
		return libelle;
	}

	/**
	 * @param libelle the libelle to set
	 */
	public void setLibelle(String libelle) {
		this.libelle = libelle;
	}
	
	/**
	 * @return the codeAlpha2
	 */
	public String getCodeAlpha2() {
		return codeAlpha2;
	}

	/**
	 * @param codeAlpha2 the codeAlpha2 to set
	 */
	public void setCodeAlpha2(String codeAlpha2) {
		this.codeAlpha2 = codeAlpha2;
	}

	/**
	 * @return the codeAlpha3
	 */
	public String getCodeAlpha3() {
		return codeAlpha3;
	}

	/**
	 * @param codeAlpha3 the codeAlpha3 to set
	 */
	public void setCodeAlpha3(String codeAlpha3) {
		this.codeAlpha3 = codeAlpha3;
	}

	/**
	 * @return the libelleCS
	 */
	public String getLibelleCS() {
		return libelleCS;
	}

	/**
	 * @param libelleCS the libelleCS to set
	 */
	public void setLibelleCS(String libelleCS) {
		this.libelleCS = libelleCS;
	}

	/**
	 * @return the libelleDE
	 */
	public String getLibelleDE() {
		return libelleDE;
	}

	/**
	 * @param libelleDE the libelleDE to set
	 */
	public void setLibelleDE(String libelleDE) {
		this.libelleDE = libelleDE;
	}

	/**
	 * @return the libelleEN
	 */
	public String getLibelleEN() {
		return libelleEN;
	}

	/**
	 * @param libelleEN the libelleEN to set
	 */
	public void setLibelleEN(String libelleEN) {
		this.libelleEN = libelleEN;
	}

	/**
	 * @return the libelleES
	 */
	public String getLibelleES() {
		return libelleES;
	}

	/**
	 * @param libelleES the libelleES to set
	 */
	public void setLibelleES(String libelleES) {
		this.libelleES = libelleES;
	}

	/**
	 * @return the libelleIT
	 */
	public String getLibelleIT() {
		return libelleIT;
	}

	/**
	 * @param libelleIT the libelleIT to set
	 */
	public void setLibelleIT(String libelleIT) {
		this.libelleIT = libelleIT;
	}

	/**
	 * @return the libelleNL
	 */
	public String getLibelleNL() {
		return libelleNL;
	}

	/**
	 * @param libelleNL the libelleNL to set
	 */
	public void setLibelleNL(String libelleNL) {
		this.libelleNL = libelleNL;
	}

	/**
     * equals implementation using a business key.
     */
	@Override
	public boolean equals(Object other) {
	    return (other instanceof Pays) && (codePays != null)
	        ? codePays.equals(((Pays) other).codePays)
	        : (other == this);
	}

	@Override
	public int hashCode() {
	    return (codePays != null)
	        ? (this.getClass().hashCode() + codePays.hashCode())
	        : super.hashCode();
	}
    
    /**
     * Set the default values.
     */
    public void initDefaultValues() {
    }
    
	@Transient
	public boolean isIdSet() {
	    return codePays != null && codePays.compareTo(Integer.valueOf(0)) != 0;
	}
    
	public Integer getId() {
		return codePays;
	}

	public void setId(Integer id) {
		codePays = id;
	}
    /**
     * Construct a readable string representation for this Account instance.
     * @see java.lang.Object#toString()
     */
    public String toString() {
        return Objects.toStringHelper(this) //
                .add("codePays", getCodePays()) //
                .add("libelle", getLibelle()) //
                .toString();
    }
}
